#
# python code to get syntax from file and prettyfy it.
#

import os, re


#
# get text from an input file, given the filename, line number, and (optionally) the number of lines to return:
def getFileText(filePath, lineStart, lineCount=1):
	if not os.access(filePath, os.F_OK):
		raise "file '%s' does not exist" % (filePath)
	if not os.access(filePath, os.R_OK):
		raise "file is not readable"

	print "Getting %d lines from '%s'" % (lineCount, filePath)
	currentLine = 1;
	file = open(filePath, "r")

	retval = ""
	
	for currentLine in xrange(lineStart - 1):
		file.readline();

	# read lineCOunt lines:
	for i in xrange(lineCount):
		retval += file.readline()

	file.close();
	return retval;

